package cn.ziyoufa.smart.smartschool.net;

import android.content.Context;

import cn.ziyoufa.smart.smartschool.db.SPManager;
import cn.ziyoufa.smart.smartschool.webview.route.Router;

/**
 * 创建人 ： 赵泽东
 * 创建时间：2018/9/30
 *
 * @param
 * @param
 */
public class GetAndroidVersionNet {
    public GetAndroidVersionNet(final Context context, final SuccessCallback successCallback, final FailCallback failCallback) {


        new NetConnection(Router.SERVER_VERSION, HttpMethod.POST, new NetConnection.SuccessCallback() {

            @Override
            public void onSuccess(String result) {
                if (!result.equals("false")) {
                    successCallback.onSuccess(result);
                }else{
                    failCallback.onFail();
                }
            }

        }, new NetConnection.FailCallback() {

            @Override
            public void onFail() {
                if (failCallback!=null) {
                    failCallback.onFail();
                }
            }
        }, Router.KEY_TOKEN, SPManager.getInstance().getString("token", ""));//键值对应

    }


    public static interface SuccessCallback{
        void onSuccess(String res);
    }

    public static interface FailCallback{
        void onFail();
    }
}
